#include <iostream>
#include <sstream>
#include <string>
using namespace std;

int main(int argc, char *argv[])
{
	cout << "argc = " << argc << endl;
	if (argc > 1){
		for (int i = 0; i < argc; i++){
			cout << "argv[" << i << "] = " << argv[i] << endl;
		}
		cout << endl;
		string s = argv[1];
		istringstream iss(s);
		int n,sum = 0;
		iss >> n;
		for (int i = 1; i < n + 1; i++){
			sum += i;
		}
		cout << "sum = " << sum << endl;
	}
	return 0;
}